package lucky.xiong.多线程;

import cn.hutool.core.thread.ThreadUtil;

import java.util.concurrent.Future;

/**
 * @author XiongJianLin
 * @date Created in 2024/12/12 15:42
 */
public class Y异步
{
    public static void main(String[] args) {

        /**
         * 异步执行时，主线程结束后，不会抛出
         */
        ThreadUtil.execAsync(() -> {
            try {

            System.out.println(111);

            throw new RuntimeException("222");
            } catch (RuntimeException e) {
                e.printStackTrace();
                System.out.println("5555555555555");
            }finally {
                System.out.println("666666666666");
            }

        });



//        try {
//            Thread.sleep(100000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
    }
}
